package com.sohoometer.web.erp.utils;

import java.util.List;

import org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;

public class CollectionsUtils {
	
	/**
	 * 在列表中查询ID为为某项属性的单个元素
	 * */
	public static <T>   T	getElement(List<T> list,String propertyName,Object propertyValue) {
		T e = null;
		Predicate predicate = new BeanPropertyValueEqualsPredicate(propertyName, propertyValue);
		e = (T) CollectionUtils.find(list, predicate); 
		return e;
	}
	

}
